#ifndef __BUOLA_GUI_CCOLORICON_H__
#define __BUOLA_GUI_CCOLORICON_H__

#include <buola/gui/ciconbase.h>
#include <buola/image/ccolor.h>
#include <unordered_map>

namespace buola { namespace gui {

///\addtogroup gui
///@{

////////////////////////////////////////////////////////////////////////////

/// solid color icon

/// This specialization of CIconBase allows to use colors as icons
///
////////////////////////////////////////////////////////////////////////////

class CColorIcon : public CIconBase
{
protected:
//! \name constructor and destructor
//@{
    CColorIcon(const img::CColor &pColor);
    virtual ~CColorIcon();
//@}

public:
    virtual bool Draw(img::CGC*,const CPoint_d&,int pSize,EStyle=NORMAL);
    img::CPicture GetPixmap(int,EStyle=NORMAL);

public:
    //! get a new color icon
    static PIcon Get(const img::CColor &pColor);

protected:
    img::CColor mColor;      //!< color for this icon

    //! map of all color icons
    static std::unordered_map<img::CColor,PIcon> mColorIcons;

    //! mutex for loading color icons
    static mutex mStaticMutex;
};

///@}

/*namespace gui*/ } /*namespace buola*/ }

#endif
